package com.vitae.service;


import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;

import java.io.Serializable;
import java.util.List;

/**
 * Created by ouyu on 2018/5/15.
 */
public interface _BaseService<T,ID extends Serializable> {
    BaseMapper<T> baseMapper();
    default List<T> findAll(){
        return baseMapper().selectList(new EntityWrapper<T>());
    }
    default List<T> findAllPage(int pageNo){
        return baseMapper().selectPage(new Page<T>(pageNo,10),new EntityWrapper<T>());
    }
    default T getOne(ID id){
        return baseMapper().selectById(id);
    }
}
